package com.chushouya.order.constants;



import com.general.framework.core.enums.IEnum;
import com.chushouya.order.dto.admin.order.OrderQuery;

import java.util.Objects;

/**
 * 业务员已完成订单查询状态定义
 * 0全部 1待发货 2待入库 3已入库 4已售出
 */
public enum ClerkCompleteOrderLogicStatusEnum implements IEnum<Integer> {

    all(0,  "全部"),
    waitDeliver(1,  "待发货"),

//    selfSaleRequest(2,  "自卖申请中"),
    waitStock(3,  "待入库"),
    inStock(4,  "已入库"),

//    saleOut(5,  "已售出")
    ;

    private Integer logicStatus;

    private String logicStatusName;


    ClerkCompleteOrderLogicStatusEnum(Integer logicStatus, String logicStatusName) {
        this.logicStatus = logicStatus;
        this.logicStatusName = logicStatusName;
    }

    public static ClerkCompleteOrderLogicStatusEnum get(Integer logicStatus) {
        for (ClerkCompleteOrderLogicStatusEnum thisEnum : ClerkCompleteOrderLogicStatusEnum.values()) {
            if (Objects.equals(thisEnum.logicStatus, logicStatus)) {
                return thisEnum;
            }
        }
        return ClerkCompleteOrderLogicStatusEnum.all;
    }

    public OrderQuery buildQuery(OrderQuery query) {
        query.setOrderStatus(OrderStatusEnum.COMPLETE.value());
        switch (this) {
            case all:
                break;
//            case waitDeliver:
//                query.setLogisticsStatus(LogisticsStatusEnum.WAIT_DELIVERY.value());
//                query.setSelfSaleStatusList(Lists.asList(SelfSaleStatusEnum.NONE.value(),
//                        SelfSaleStatusEnum.BACKOUT.value()
//                ));
//                break;
//            case selfSaleRequest:
//                query.setSelfSaleStatus(SelfSaleStatusEnum.SETTLE_CONFIRM.value());
//                break;
//            case waitStock:
//                query.setStockStatus(StockStatusEnum.WAIT_STOCK.value());
//                break;
//            case inStock:
//                query.setStockStatus(StockStatusEnum.IN_STOCK.value());
//                break;
//            case saleOut:
//                query.setSaleStatus(SaleStatusEnum.SALE_OUT.value());
//                break;
        }
        return query;
    }

    @Override
    public Integer value() {
        return logicStatus;
    }

    @Override
    public String named() {
        return logicStatusName;
    }
}
